﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OnWork.DataCenter.BLL.Standard
{
    /// <summary>
    /// 数据执行类型
    /// </summary>
    public enum DataTableToDBConfigType
    {
        /// <summary>
        /// 仅插入
        /// </summary>
        [Description("仅插入")]
        InsertOnly = 0,

        /// <summary>
        /// 更新并插入
        /// </summary>
        [Description("更新并插入")]
        UpdateInsert = 1,

        /// <summary>
        /// 删除并插入
        /// </summary>
        [Description("删除并插入")]
        DeleteInsert = 2,

        /// <summary>
        /// 删除并插入
        /// </summary>
        [Description("仅删除(依据主键)")]
        DeleteByPK = 3,
    }

    /// <summary>
    /// DateTable转数据库
    /// </summary>
    public class DataTableToDBConfig
    {
        /// <summary>
        /// 数据库连接 DSDataBase配置ID
        /// </summary>
        public long DBID { get; set; }

        /// <summary>
        /// 数据库连接
        /// </summary>
        public string DBConn { get; set; }

        /// <summary>
        /// 数据库类型
        /// </summary>
        public DbType DBType { get; set; } = DbType.SqlServer;

        /// <summary>
        /// 表名
        /// </summary>
        public string DBTable { get; set; }

        /// <summary>
        /// 数据库列
        /// </summary>
        public List<DBCol> DBCols { get; set; }

        /// <summary>
        /// 配置类型
        /// </summary>
        public DataTableToDBConfigType ConfigType { get; set; } = DataTableToDBConfigType.UpdateInsert;
    }
}